﻿using System.ComponentModel.DataAnnotations;

namespace StudentManegement.Models
{
    /// <summary>
    /// 学生模型
    /// </summary>
    public class StudentModel
    {
        public int Id { get; set; }

        [Display(Name = "姓名"), MaxLength(50, ErrorMessage = "名字的长度不能超过50个字符")]
        [Required(ErrorMessage ="名字不能为空")]  
        public string Name { get; set; }

        [Display(Name = "班级名称")]
        [Required(ErrorMessage = "班级名称不能为空")] //Required：必填的意思
        public string ClassName { get; set; }

        [RegularExpression(@"^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$",
    ErrorMessage = "邮箱的格式不正确")]
        [Display(Name = "邮件地址")]
        public string? EmailAddress { get; set; }

        [Display(Name = "主修科目")]
        [Required]
        public MajorEnum Major { get; set; }

        public string? PhotoPath { get; set; }

        //public int deleteProperty { get; set; }
    }
}
